package com.rd.student.jiaji.class3.caiyuxin.Day0728;

import java.util.LinkedList;
import java.util.Random;
import java.util.Scanner;


public class RadomName1 {
    public static void main(String[] args) {
        LinkedList list=new LinkedList();
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入想随机抽出的人数：");
        int n=scanner.nextInt();
        list.add("才雨鑫");
        list.add("张世煊");
        list.add("徐铭泽");
        list.add("秦嘉琳");
        list.add("王彦博");
        list.add("孙国伟");
        list.add("123");
        list.add("456");
        list.add("789");

        nameradom(list,n);



    }
    public static void nameradom(LinkedList list,int n){
        LinkedList radomlist=new LinkedList();
        for (int i=0;i<list.size();i++){
            radomlist.add(list.get(i));
        }
        Random random=new Random();
        System.out.println("被随机抽到的人员有：");
        for (int j=0;j<n;j++) {

            int i = random.nextInt(radomlist.size());


            System.out.print(radomlist.get(i)+" ");
            radomlist.remove(i);
        }

    }
}
